/*
 * main.c
 *
 *  Created on: Jul 28, 2013
 *      Author: lxzhu
 */
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

void onDraw();
void drawPolygon(float x, float y);

int main(int argc, char** argv){
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
	glutCreateWindow("EdgeFlag");
	glutDisplayFunc(onDraw);
	glClearColor(1,1,1,1);
	glColor3f(0,1,0);
	glutMainLoop();
	return 0;
}

void onDraw(){
  glClear(GL_COLOR_BUFFER_BIT);
  glPolygonMode(GL_FRONT,GL_LINE);
  glEdgeFlag(GL_TRUE);
  drawPolygon(-0.75,-0.75);
  glEdgeFlag(GL_FALSE);
  drawPolygon(0.25,0.25);
  glutSwapBuffers();
}
void drawPolygon(float x, float y){
	glBegin(GL_POLYGON);
	 glVertex2f(x,y);
	 glVertex2f(x+0.3,y+0.2);
	 glVertex2f(x+0.5,y);
	 glVertex2f(x+0.5,y+0.5);
	 glVertex2f(x+0.25,y+0.4);
	 glVertex2f(x,y+0.5);
	glEnd();
}



